#include "tppolicyinfo.h"

QDBusArgument &operator<<(QDBusArgument &argument, const TPPolicyInfo &info)
{
    argument.beginStructure();
    argument << info.action << info.func << info.appRaise << info.targetPath << info.imaType << info.policyType << info.customPolicyType << info.policyModifyType;
    argument.endStructure();
    return argument;
}

const QDBusArgument &operator>>(const QDBusArgument &argument, TPPolicyInfo &info)
{
    argument.beginStructure();
    argument >> info.action >> info.func >> info.appRaise >> info.targetPath >> info.imaType >> info.policyType >> info.customPolicyType >> info.policyModifyType;
    argument.endStructure();
    return argument;
}

void registerTPPolicyInfoMetaType()
{
    qRegisterMetaType<TPPolicyInfo>("TPPolicyInfo");
    qDBusRegisterMetaType<TPPolicyInfo>();
}

void registerTPPolicyInfoListMetaType()
{
    qRegisterMetaType<TPPolicyInfoList>("TPPolicyInfoList");
    qDBusRegisterMetaType<TPPolicyInfoList>();
}

bool TPPolicyInfo::operator==(const TPPolicyInfo &policy)
{
    return this->targetPath == policy.targetPath;
}
